package com.app.service.impl;

import com.app.mapper.MatterMapper;
import com.app.model.MatterModel;
import com.app.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MatterServiceImpl implements MatterService {
    @Autowired
    private MatterMapper matterMapper;

    @Override
    public void insert(MatterModel matterModel) {
        Integer id = matterModel.getDutyName();
        Integer pid = matterMapper.selectPid(id);
        matterModel.setPid(pid);
        matterMapper.insert(matterModel);
    }

    @Override
    public void update(MatterModel matterModel) {
        Integer id = matterModel.getDutyName();
        Integer pid = matterMapper.selectPid(id);
        matterModel.setPid(pid);
        matterMapper.updateById(matterModel);
    }

    @Override
    public void deleteMatterById(int id) {
        matterMapper.deleteById(id);
    }

    @Override
    public void updateTime(MatterModel matterModel) {
        matterMapper.updateById(matterModel);
    }
}
